package com.manli.api.controller;

import com.alibaba.fastjson.JSONObject;
import com.manli.api.base.annotation.Permissions;
import com.manli.api.pojo.*;
import com.manli.api.service.TaoBaokeService;
import com.manli.common.utils.HttpUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 淘宝客
 *
 * @author manli
 * @email
 * @date 2020-05-15 13:13:01
 */
@Slf4j
@Api(value="/taobaoke", tags="淘宝客")
@RestController
@RequestMapping("api/taobaoke")
public class TaoBaokeController {
    @Autowired
    private TaoBaokeService taoBaokeService;

    /**
     * 通过商品名获取图片列表
     */
    @ApiOperation(value = "通过商品名获取图片列表")
    @PostMapping("/getImageByGoodsName")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_LOGIN)
    public Result getImageByGoodsName(@RequestBody QueryParamsTaobaoke params)throws Exception{
        return taoBaokeService.getImageByGoodsName(params);
    }

    /**
     * 可爱猫自动回复测试
     */
    @PostMapping("/cat")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_OPEN)
    public Object cat(CuteCat cuteCat)throws Exception{
        log.info("接收到可爱猫微信机器人消息：" + cuteCat);
        return taoBaokeService.cat(cuteCat);
    }

    /**
     * 拉群分享结算统计
     */
    @ApiOperation(value = "拉群分享结算统计")
    @PostMapping("/catStatic")
    @Permissions(module = "", privilege = "", typeOfAccess = Permissions.METHOD_OPEN)
    public Result catStatic(@RequestBody QueryParamsCatStatic queryParamsCatStatic)throws Exception{
        log.info("拉群分享结算统计消息：" + queryParamsCatStatic);
        return taoBaokeService.catStatic(queryParamsCatStatic);
        
    }


}
